﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Text.RegularExpressions;
using System.Globalization;

namespace UDPTest
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        Decoding d = new Decoding();
        private void button1_Click(object sender, EventArgs e)
        {
            string hexText = this.richTextBox1.Text.Replace(" ", "").Replace("\n", "");
            string result = d.get_Hextext(HasCode.ASCII, hexText);
           
            if (!string.IsNullOrEmpty(result))
            {
                
                this.richTextBox2.Text = result;
            }
            else
            {
                this.richTextBox2.Text = "不是16进制文本";
            }
        }
 
        private void button2_Click(object sender, EventArgs e)
        {
            string text = this.richTextBox1.Text.Replace(" ", "").Replace("\n", "");
            string result = d.Convert(text, HasCode.UNICODE);
            if (!string.IsNullOrEmpty(result))
            {
                this.richTextBox2.Text = result;
            }
            else
            {
                this.richTextBox2.Text = "不是16进制文本";
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            string text = this.richTextBox1.Text.Replace("\n", "").Replace(" ",",");

            string[] thebyte = text.Split(',');
            
            //d.ConvertToString();
        }

    }
}
 